package com.zablert.mainactivity.teaching;

import static com.zablert.mainactivity.BaseRouteConstants.TEACHING_ACTIVITY_PATH;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.zablert.mainactivity.R;

import java.util.ArrayList;
import java.util.List;

@Route(path = TEACHING_ACTIVITY_PATH)
public class LearningActivity extends AppCompatActivity {
    private RecyclerView rvLearning;
    private LearningAdapter adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_learning);
        rvLearning = findViewById(R.id.rv_learning);
        rvLearning.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
        rvLearning.setAdapter(adapter = new LearningAdapter());
        adapter.setData(generateLearningParams());
        adapter.notifyDataSetChanged();
    }

    private List<LearningParam> generateLearningParams() {
        List<LearningParam> learningParams = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            learningParams.add(new LearningParam("阿弥陀佛 " + i + 1, "我是一个详细的描述，很详细"));
        }
        return learningParams;
    }
}
